Skip to content

ci: harden workflows (least privilege, harden-runner, SHA pins) - #396

Open
kwburns-kong wants to merge 4 commits into
masterfrom
chore/harden-workflows
Open

kwburns-kong wants to merge 4 commits into
masterfrom
chore/harden-workflows

Conversation

@kwburns-kong

Copy link
Copy Markdown

Hardens the GitHub Actions workflows.

  1. Least privilege: permissions: {} by default, minimal per-job scopes, persist-credentials: false, timeouts, concurrency, ${{ }} in run moved to env vars.
  2. harden-runner: added to every job (audit mode).
  3. SHA pins + bumps: all actions pinned by SHA and updated to latest (Kong sca 4.1.4; semgrep action kept at its current pin because 4.0.4 fails with pkg_resources missing).

Note for CI:

  • publish job permissions reduced to contents: read + id-token: write (dropped contents: write, actions: read, packages: write; npm provenance only needs OIDC). Verify on the next tag.
  • release keeps persist-credentials: true since it pushes with the app token; the job token is now read-only.
  • Concurrency cancels in-progress PR runs only, never master or tag runs.
  • scan keeps contents: write + packages: write for the SCA SBOM upload.
  • Nothing was run before this PR; the first PR run covers build/sast, while publish and release only run on tag / manual dispatch.

Default permissions to none, scope per job (publish drops unneeded
contents:write, actions:read, packages:write), disable persisted
checkout credentials except where release pushes, move expression
interpolation in run steps to env vars, add timeouts and concurrency,
fixed runner image.
Newer semgrep action (4.0.4) installs semgrep 1.135.0, which fails with
'No module named pkg_resources' on Python 3.12.
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants